package com.rjh.concurrent.create;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j(topic = "c.DeamonThreadDemo")
public class DeamonThreadDemo {

    public static void main(String[] args) throws InterruptedException {

        Thread deamonThread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true){
                    log.info("DeamonThreadDemo running");
                }
            }
        });

        deamonThread.setDaemon(true);
        deamonThread.start();
        TimeUnit.SECONDS.sleep(2);
        log.info("deamonThread.getState : {}",deamonThread.getState());
//        TimeUnit.SECONDS.sleep(2);
    }
}
